package com.sg.hms.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sg.hms.Service.FoodService;
import com.sg.hms.ServiceImpl.FoodServiceImpl;
/**
 * 
 * @author 张杨
 *
 */
public class UpdateFoodController extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		FoodService fService=new FoodServiceImpl();
		String fid=req.getParameter("fid");
		String fName=req.getParameter("fname");
		String weight=req.getParameter("weight");
		int a=fService.updateFood(Integer.parseInt(fid), fName, Integer.parseInt(weight));
		req.getRequestDispatcher("foodManage").forward(req, resp);

	}
}
